# cmake 中的行注释
#[[
    cmake中的块注释
    这是一个CMakeLists.txt文件
]]

# cmake所需最低版本，可以不加，不加可能会有警告
cmake_minimum_required(VERSION 3.0.0)
#指定工程名
project(cmake_study)

#SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]])  VAR: 变量名  VALUE: 变量值
#set(SRC_LIST add.cpp div.cpp main.cpp min.cpp plu.cpp)

include_directories(${PROJECT_SOURCE_DIR}/include)
#搜索源文件
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC_LIST)
#file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

#指定c++执行标准 也可在命令行指定
set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD 98)

#指定库文件生成路径
# set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
#制作库文件
# add_library(cala STATIC ${PROJECT_SOURCE_DIR}/src/min.cpp ${PROJECT_SOURCE_DIR}/src/plu.cpp ${PROJECT_SOURCE_DIR}/src/add.cpp ${PROJECT_SOURCE_DIR}/src/div.cpp)
# add_library(cals SHARED ${PROJECT_SOURCE_DIR}/src/min.cpp ${PROJECT_SOURCE_DIR}/src/plu.cpp ${PROJECT_SOURCE_DIR}/src/add.cpp ${PROJECT_SOURCE_DIR}/src/div.cpp)

#链接静态库
 link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
# link_libraries(cala)

#指定生成路径
set(BIN ../bin)
set(EXECUTABLE_OUTPUT_PATH ${BIN})

#生成可执行程序(可执行文件名 源文件名称)
add_executable(cmake_test ${SRC_LIST})

#可执行文件链接动态库
target_link_libraries(cmake_test
    cals
)